<!--
 * @Date: 2020-01-06 09:28:29
 * @LastEditors  : Vi卡农
 * @LastEditTime : 2020-01-10 17:58:05
 * @describe: -房源-需求匹配-housePipei
 -->
<template>
  <el-card
    shadow="never"
    class="aui-card--fill"
  >
    <div class="mod-customer__customerfollow}">
      <el-form
        :inline="true"
        :model="dataForm"
        @keyup.enter.native="getDataList()"
      >
        <el-form-item>
          <el-checkbox
            v-model="dataForm.dict"
            true-label="1"
            false-label="0"
            @change="getDataList()"
          >楼盘</el-checkbox>
          <el-checkbox
            v-model="dataForm.area"
            true-label="1"
            false-label="0"
            @change="getDataList()"
          >面积</el-checkbox>
          <el-checkbox
            v-model="dataForm.price"
            true-label="1"
            false-label="0"
            @change="getDataList()"
          >价格</el-checkbox>
          <el-checkbox
            v-model="dataForm.renovation"
            true-label="1"
            false-label="0"
            @change="getDataList()"
          >装修</el-checkbox>
        </el-form-item>
      </el-form>
      <el-table
        v-loading="dataListLoading"
        :data="dataList"
        border
        style="width: 100%;"
      >
        <el-table-column
          prop="id"
          label="客源编号"
          header-align="center"
          align="center"
        >
          <!-- <template slot-scope="scope">
            {{"KY - "+scope.row.id.substring(scope.row.id.length-6)}}
          </template> -->
          <template slot-scope="scope">
            <el-button
              type="text"
              @click="gotoHouse(scope.row)"
            >{{"KY - "+scope.row.id.substring(scope.row.id.length-6)}}</el-button>
          </template>
        </el-table-column>
        <el-table-column
          prop="maintainName"
          label="维护人"
          header-align="center"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="phone"
          label="联系方式"
          header-align="center"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="deptName"
          label="维护人部门"
          header-align="center"
          align="center"
        >
        </el-table-column>
        <el-table-column
          prop="situation"
          label="房屋现状"
          header-align="center"
          align="center"
        >
          <template slot-scope="scope">{{$getDictLabel("dictSituation", scope.row.situation)}}</template>
        </el-table-column>

      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle"
      ></el-pagination>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: "/house/houseinfo/matchingCustomer",
        getDataListIsPage: true
      },
      dataForm: {
        houseId: this.$route.query.ID,
        dict: "",
        area: "",
        price: "",
        renovation: ""
      }
    };
  },
  methods: {
    gotoHouse(row) {
      let _this = this;
      this.$router.push({
        name: "customerPage",
        query: {
          ID: row.id,
          customerType: row.customerType
        }
      });
    }
  },
  components: {},
  watch: {
    $route(to, from) {
      if (to.name == "customerPage") {
        this.dataForm.houseId = this.$route.query.ID;
        this.query();
      }
    }
  }
};
</script>
